# Contributor: Oleg Titov <oleg.titov@gmail.com>
# Maintainer: Oleg Titov <oleg.titov@gmail.com>
pkgname=py3-timeago
pkgver=1.0.16
pkgrel=0
pkgdesc="Python library, used to format datetime with *** time ago statement"
url="https://github.com/hustcc/timeago"
arch="noarch"
license="MIT"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-doc $pkgname-pyc"
source="py3-timeago-$pkgver.tar.gz::https://github.com/hustcc/timeago/archive/refs/tags/$pkgver.tar.gz"
builddir="$srcdir/timeago-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest test/testcase.py
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl

	install -Dm644 README.md -t "$pkgdir"/usr/share/doc/$pkgname
}

sha512sums="
1106abe17cfb34324ee9194141598698abbe1c0ed36273d449fdc9047aa42e369845be0041bdffc4470f00602df20bf981de3ad16f10c22d65de4c0a41d65e73  py3-timeago-1.0.16.tar.gz
"
